package limbo.demo;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.List;

import limbo.beans.Book;
import limbo.xmlParse.Dom4jParseService;
import limbo.xmlParse.DomParseService;
import limbo.xmlParse.SaxParseService;

public class Limbo {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
//		DomParseService parseService = new DomParseService();
//		SaxParseService parseService = new SaxParseService();
		Dom4jParseService parseService = new Dom4jParseService();
		InputStream inputStream = null;
		try {
			inputStream = new FileInputStream("file/book.xml");
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		try {
			List<Book> list = parseService.getBooks(inputStream);
			for (Book book : list) {
				System.out.println("book id = " + book.getId() + ",book name ="
						+ book.getName() + ",book price = " + book.getPrice());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}
